<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
	<title>捐赠管理-捐款管理</title>
	<link rel="icon" href="favicon.ico" type="image/ico">
	<meta name="keywords" content="审核">
	<meta name="author" content="yinqi">
	<link href="/css/bootstrap.min.css" rel="stylesheet">
	<link href="/css/materialdesignicons.min.css" rel="stylesheet">
	<link rel="stylesheet" href="/js/jconfirm/jquery-confirm.min.css">
	<link href="/css/style.min.css" rel="stylesheet">

</head>
<body>
<div class="row">
	<div class="col-lg-12">
		<div class="card">
			<div class="card-body">

				<form action="/mon/updateMonById" method="post" class="row" >
					<input type="hidden" name="moneyId" id="moneyId" th:value="${monStu.moneyId}">
					<input type="hidden" name="monId" id="monId" th:value="${monStu.monId}">
					<div class="form-group col-md-4"></div>
					<div class="form-group col-md-3">
						<label for="monName">捐款人</label>
						<input type="text" class="form-control" id="monName" name="monName" th:value="${monStu.tbStu.name}" readonly/>
					</div>
					<div class="form-group col-md-5"></div>
					<div class="form-group col-md-12"></div>



					<div class="form-group col-md-4"></div>
					<div class="form-group col-md-3">
						<label for="monCount">捐款金额</label>
						<input type="text" class="form-control" id="monCount" name="monCount" th:value="${monStu.moneyCount}" readonly>
					</div>
					<div class="form-group col-md-5"></div>
					<div class="form-group col-md-12"></div>

					<div class="form-group col-md-4"></div>
					<div class="form-group col-md-3">
						<label>捐款方式</label>
						<p th:if="${monStu.monType}==0">手动捐款</p>
						<p th:if="${monStu.monType}==1">在线支付</p>
					</div>
					<div class="form-group col-md-5"></div>
					<div class="form-group col-md-12"></div>


					<div class="form-group col-md-4"></div>
					<div class="form-group col-md-3">
						<label for="monTime">捐款时间</label>
						<input type="text" class="form-control" id="monTime" name="monTime" th:value="${#temporals.format(monStu.moneyTime,'yyyy-MM-dd HH:mm:ss')}" readonly/>
					</div>
					<div class="form-group col-md-5"></div>
					<div class="form-group col-md-12"></div>

					<div class="form-group col-md-4"></div>
					<div class="form-group col-md-3">
						<label>审核状态</label>
						<div class="clearfix">
							<label class="lyear-radio radio-inline radio-primary">
								<input type="radio" name="monStatus" value="0" th:checked="${monStu.monStatus==0}"><span>未审核</span>
							</label>
							<label class="lyear-radio radio-inline radio-primary">
								<input type="radio" name="monStatus" value="1" th:checked="${monStu.monStatus==1}"><span>审核通过</span>
							</label>
							<label class="lyear-radio radio-inline radio-primary">
								<input type="radio" name="monStatus" value="2" th:checked="${monStu.monStatus==2}"><span>审核未通过</span>
							</label>
						</div>
					</div>
					<div class="form-group col-md-5"></div>
					<div class="form-group col-md-12"></div>


					<div class="form-group col-md-4"></div>
					<div class="form-group col-md-3">

						<button type="button" onclick="editMonStu()" class="btn btn-primary ajax-post" target-form="add-form">确 定</button>
						<button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
					</div>
				</form>

			</div>
		</div>
	</div>

</div>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/perfect-scrollbar.min.js"></script>
<script src="/js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="/js/lightyear.js"></script>
<script type="text/javascript" src="/js/main.min.js"></script>
<script type="text/javascript" src="/js/axios.min.js"></script>
<script src="/js/jconfirm/jquery-confirm.min.js"></script>
<script type="text/javascript">

	function editMonStu() {
	    var moneyId=$("#moneyId").val();
        var monStatus=$("input[name=monStatus]:checked").val()
        var monId=$("#monId").val();
		if(monStatus.trim()==""&&monStatus==null){
            $.confirm({
                title: '捐款审核',
                content: '请选择审核状态',
                type: 'red',
                buttons: {
                    tryAgain: {
                        text: '确认',
                        btnClass: 'btn-red',
                        action: function () {
                            return false;
                        }
                    }
                }
            });
		}
        lightyear.loading('show');
		axios.get("/mon/updateMonStuById?moneyId="+moneyId+"&monStatus="+monStatus)
			.then(function (response) {
                var data=response.data;
                if(data==1){
                    $.alert({
                        title: '捐款审核',
                        content: '审核成功，确认返回主页',
                        buttons: {
                            confirm: {
                                text: '确认',
                                btnClass: 'btn-primary',
                                action: function () {
                                    location.href = "/mon/getMonStuById?monId="+monId
                                }
                            }
                        }
                    });
                }else {
                    $.confirm({
                        title: '捐款审核',
                        content: '审核失败，检查审核信息',
                        type: 'red',
                        buttons: {
                            tryAgain: {
                                text: '确认',
                                btnClass: 'btn-red',
                            }
                        }
                    });
                }
            })
        setTimeout(function() {
            lightyear.loading('hide');
        })
    }

</script>
</body>
</html>